﻿<navigation:Page x:Class="GroupChallenge.HomeView"
                 xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                 xmlns:ctrls="clr-namespace:GroupChallenge.Controls"
                 x:Name="ThisPage"
                 mc:Ignorable="d"
                 d:DesignWidth="800"
                 d:DesignHeight="492"
                 Style="{StaticResource PageStyle}"
                 xmlns:my="clr-namespace:GroupChallenge.Views">
    <Grid x:Name="LayoutRoot"
          Background="DarkBlue">
        <ScrollViewer x:Name="PageScrollViewer"
                      Style="{StaticResource PageScrollViewerStyle}">
            <StackPanel x:Name="ContentStackPanel"
                        Style="{StaticResource ContentStackPanelStyle}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="600" />
                        <ColumnDefinition Width="240" />
                    </Grid.ColumnDefinitions>
                    <MediaElement x:Name="NextQuestionMediaElement"
                                  Source="/GroupChallenge;component/Sounds/NextQuestion.mp3"
                                  AutoPlay="False"></MediaElement>
                    <MediaElement x:Name="QuestionWonMediaElement"
                                  Source="/GroupChallenge;component/Sounds/QuestionWon.mp3"
                                  AutoPlay="False"></MediaElement>
                    <MediaElement x:Name="ClapMediaElement"
                                  Source="/GroupChallenge;component/Sounds/Clap.mp3"
                                  AutoPlay="False"></MediaElement>
                    <my:QuestionView Grid.Row="0"
                                     Grid.RowSpan="3"
                                     DataContext="{Binding Path=CurrentQuestion}"
                                     x:Name="questionView1"
                                     Foreground="{StaticResource BodyBrightTextColorBrush}" />
                    <Grid HorizontalAlignment="Center"
                          VerticalAlignment="Center"
                          x:Name="WinnerGrid"
                          Grid.Row="1"
                          Height="279"
                          Width="355"
                          Margin="50,60,143,-144"
                          Visibility="Collapsed"
                          Background="AliceBlue">
                        <TextBlock x:Name="WinnerMessageTextBlock"
                                   Foreground="DarkBlue"
                                   FontSize="28"
                                   HorizontalAlignment="Center"
                                   Text="{Binding Path=WinnerMessage}" />
                        <ctrls:PlayerImageView x:Name="playerImageView1"
                                               DataContext="{Binding Path=WonByPlayerId, Converter={StaticResource PlayerIdToPlayerImageConverter}}"
                                               Margin="0,45,0,0" />
                    </Grid>
                    <StackPanel Orientation="Horizontal"
                                Grid.Column="1">
                        <TextBlock x:Name="CurrentQuestionIdLabel"
                                   Text="Current Question Id:  "
                                   VerticalAlignment="Center"
                                   HorizontalAlignment="Right"
                                   Foreground="{StaticResource BodyBrightTextColorBrush}" />
                        <TextBlock x:Name="CurrentQuestionIdTextBlock"
                                   VerticalAlignment="Center"
                                   Text="{Binding Path=CurrentQuestionId}"
                                   Foreground="{StaticResource BodyBrightTextColorBrush}" />
                    </StackPanel>
                    <Grid Grid.Row="1"
                          Grid.Column="1">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Button Content="Next Question >>"
                                Grid.Row="0"
                                Grid.Column="0"
                                Height="35"
                                Margin="2"
                                Name="NextQuestion"
                                Click="NextQuestion_Click" />
                        <Button Content="Game Over"
                                Grid.Row="1"
                                Grid.Column="0"
                                Height="35"
                                Margin="2"
                                Name="GameOverButton"
                                Click="GameOverButton_Click" />
                        <Button Content="Restart Game"
                                Grid.Row="2"
                                Grid.Column="0"
                                Height="35"
                                Margin="2"
                                Name="RestartGameButton"
                                Click="RestartGameButton_Click" />
                        <Button Content="Sound 1"
                                Grid.Row="1"
                                Grid.Column="1"
                                Height="35"
                                Margin="2"
                                Name="NextQuestionSoundTestButton"
                                Click="NextQuestionSoundTestButton_Click" />
                        <Button Content="Sound 2"
                                Grid.Row="2"
                                Grid.Column="1"
                                Height="35"
                                Margin="2"
                                Name="QuestionWonSoundTestButton"
                                Click="QuestionWonSoundTestButton_Click" />
                    </Grid>
                    <sdk:DataGrid AutoGenerateColumns="False"
                                  MaxHeight="200"
                                  Grid.Row="2"
                                  Grid.Column="1"
                                  IsReadOnly="True"
                                  Name="GameQuestionLineupList"
                                  ItemsSource="{Binding Path=RandomizedQuestions, Mode=TwoWay}">
                        <sdk:DataGrid.Columns>
                            <sdk:DataGridTemplateColumn CanUserReorder="True"
                                                        CanUserResize="True"
                                                        CanUserSort="True"
                                                        Width="Auto"
                                                        Header="Question Id">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button Content="{Binding Path=QuestionId}"
                                                Click="SetCurrentQuestionButton_Click" />
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTextColumn Binding="{Binding Path=WonByPlayerNickName}"
                                                    Header="Won By Player"
                                                    CanUserReorder="True"
                                                    CanUserResize="True"
                                                    CanUserSort="True"
                                                    Width="Auto" />
                            <!--<sdk:DataGridTextColumn Binding="{Binding Path=QuestionText}"
                                                    Header="Question"
                                                    CanUserReorder="True"
                                                    CanUserResize="True"
                                                    CanUserSort="True"
                                                    Width="Auto" />-->
                        </sdk:DataGrid.Columns>
                    </sdk:DataGrid>
                </Grid>
            </StackPanel>
        </ScrollViewer>
    </Grid>
</navigation:Page>